﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace smallDeimos.Game.Controls
{
    public partial class PercentageBar : System.Web.UI.UserControl
    {//see this http://www.codeproject.com/KB/webforms/progressBarcontrol.aspx
        public int progressedValue = 50;
        public int maxValue = 100;

        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected override void Render(HtmlTextWriter output)
        {
            //table start tag

            output.Write("<table width=\"200\" border=\"0\">");
            //row start tag

            output.Write("<tr>");
            //

            //Progress Indicator Column start tag

            output.Write("<td");
            //calculate width in percent

            output.Write(" width=\"" + progressedValue * 100 / maxValue);
            //the rest of column start&end tags

            output.Write("\" bgcolor=\"#0099FF\">" +
                   progressedValue * 100 / maxValue + "% </td>");

            //second Column start tag

            output.Write("<td");
            //calculate width in percent

            output.Write("\" width=\"" + (100 - (progressedValue * 100 / maxValue)));
            //the rest of column start&end tags
            output.Write("\" bgcolor=\"#00061C\"><div></div></td>");
            //row end tag

            output.Write("</tr>");
            //table end tag

            output.Write("</table>");
            //done...

        }
    }
}